package com.fullstack.landscape.editor.gui;

import com.fullstack.landscape.editor.LandscapeEditorApplication;
import com.fullstack.landscape.editor.service.ConfigService;
import de.felixroske.jfxsupport.FXMLController;
import javafx.event.ActionEvent;
import javafx.fxml.FXML;
import javafx.scene.control.TextField;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.slf4j.LoggerFactory.getLogger;

/**
 * @author leven.chen
 * @project landscape-editor
 * @date 2019/4/16 17:05
 * @apiNote
 */
@FXMLController
public class MainFXController {

    /**
     * logger
     */
    private static final Logger log = getLogger(MainFXController.class);


    private final ConfigService configService;

    @FXML
    private TextField tfWorkspace;

    public MainFXController(ConfigService configService) {
        this.configService = configService;
    }

    @FXML
    private void initialize() {
        String workspace = configService.getWorkspace();
        tfWorkspace.setText(workspace);
    }

    public void openEditor(ActionEvent actionEvent) {
        LandscapeEditorApplication.openChrome();
    }

}
